import axios from 'axios';

// export const test = 'http://192.168.16.91:8000';
// export const url = 'http://192.168.16.91';

export const test = 'http://127.0.0.1:8000';
// // export const test = 'http://localhost:8000';
// // export const test = 'http://0.0.0.0:8000';
// export const url = 'http://0.0.0.0';


// 钉钉配置
export const dingConfig = params => {
    return axios.get(`${test}/api/user/dingConfig`, params).then(res => res.data);
};
// 钉钉登录
export const dingLogin = params => {
    return axios.post(`${test}/api/user/dingConfig`, params).then(res => res.data);
};
// 登录
export const requestLogin = params => {
    return axios.post(`${test}/api/user/login`, params).then(res => res.data);
};
// 记录访客
export const recordVisitor = params => {
    return axios.post(`${test}/api/user/VisitorRecord`, params).then(res => res.data);
};
// 获取项目
export const getProject = (headers, params) => {
    return axios.get(`${test}/api/project/project_list`, {params: params, headers: headers}).then(res => res.data);
};
//获取接口getLyzdInterface

export const getLyzdInterface = (headers, params) => {
    return axios.get(`${test}/api/project/interface_list`, {params: params, headers: headers}).then(res => res.data);
};

export const getRunResult = (headers, params) => {
    return axios.get(`${test}/api/project/getRunResult`, {params: params, headers: headers}).then(res => res.data);
};
//getLyzdCase

export const getLyzdCase = (headers, params) => {
    return axios.get(`${test}/api/project/getLyzdCaseList`, {params: params, headers: headers}).then(res => res.data);
};

export const getJavaDecrypt = (headers, params) => {
    return axios.get(`${test}/api/project/getJavaDecrypt`, {params: params, headers: headers}).then(res => res.data);
};

export const getLyzdCaseCG = (headers, params) => {
    return axios.get(`${test}/api/project/getLyzdCaseCGList`, {params: params, headers: headers}).then(res => res.data);
};



export const getLyzdScript = (headers, params) => {
    return axios.get(`${test}/api/project/getLyzdScriptList`, {params: params, headers: headers}).then(res => res.data);
};


export const getTablebyDbID = (headers, params) => {
    return axios.get(`${test}/api/project/getTablebyDbID`, {params: params, headers: headers}).then(res => res.data);
};


export const getDatebase = (headers, params) => {
    return axios.get(`${test}/api/project/getDatebaseList`, {params: params, headers: headers}).then(res => res.data);
};

export const getTable = (headers, params) => {
    return axios.get(`${test}/api/project/getTableList`, {params: params, headers: headers}).then(res => res.data);
};

//测试代码迁移的页面展示
export const getResult = (headers, params) => {
    return axios.get(`${test}/api/project/getResult`, {params: params, headers: headers}).then(res => res.data);
};

//批量导入接口
export const ImportInterface = (headers, params) =>{
    return axios.post(`${test}/api/api/ExcleImport`, params, {headers}).then(res => res.data);
};


//获取龙盈智达环境
export const getLyzdEnvironments = (headers, params) => {
    return axios.get(`${test}/api/project/environment_list`, {params: params, headers: headers}).then(res => res.data);
};



export const getLyzdDingDings = (headers, params) => {
    return axios.get(`${test}/api/project/dingding_list`, {params: params, headers: headers}).then(res => res.data);
};
//getLyzdProjects
export const lyzdProjectLists = (headers, params) => {
    return axios.get(`${test}/api/project/lyzdProjectLists`, {params: params, headers: headers}).then(res => res.data);
};


export const getLyzdModels = (headers, params) => {
    return axios.get(`${test}/api/project/model_list`, {params: params, headers: headers}).then(res => res.data);
};

export const editStatus_environment = (headers, params) => {
    return axios.post(`${test}/api/api/editStatus_environment`, params, {headers}).then(res => res.data);
};

export const editStatus_DingDing = (headers, params) => {
    return axios.post(`${test}/api/api/editStatus_dingding`, params, {headers}).then(res => res.data);
};
//editStatus_api
export const editStatus_api = (headers, params) => {
    return axios.post(`${test}/api/api/editStatus_api`, params, {headers}).then(res => res.data);
};


export const editStatus_case = (headers, params) => {
    return axios.post(`${test}/api/api/editStatus_case`, params, {headers}).then(res => res.data);
};

export const addEnvironment = (headers, params) => {
    return axios.post(`${test}/api/project/add_environment`, params, {headers}).then(res => res.data);
};

export const addDingDing = (headers, params) => {
    return axios.post(`${test}/api/project/add_dingding`, params, {headers}).then(res => res.data);
};

export const addDatabase = (headers, params) => {
    return axios.post(`${test}/api/project/add_database`, params, {headers}).then(res => res.data);
};

export const addTable = (headers, params) => {
    return axios.post(`${test}/api/project/add_table`, params, {headers}).then(res => res.data);
};
export const addModel = (headers, params) => {
    return axios.post(`${test}/api/project/add_model`, params, {headers}).then(res => res.data);
};

export const addLyzdProject = (headers, params) => {
    return axios.post(`${test}/api/project/addLyzdProject`, params, {headers}).then(res => res.data);
};
export const updateLyzdProject = (headers, params) => {
    return axios.post(`${test}/api/project/updateLyzdProject`, params, {headers}).then(res => res.data);
};

//editProjectStatus

export const editProjectStatus = (headers, params) => {
    return axios.post(`${test}/api/project/editProjectStatus`, params, {headers}).then(res => res.data);
};
export const editModelStatus = (headers, params) => {
    return axios.post(`${test}/api/project/editModelStatus`, params, {headers}).then(res => res.data);
};
// 修改环境
export const updateModel = (headers, params) => {
    return axios.post(`${test}/api/project/update_model`, params, {headers}).then(res => res.data);
};



// 删除环境
export const delEnvironment = (headers, params) => {
    return axios.post(`${test}/api/project/del_environment`, params, {headers}).then(res => res.data);
};
export const delDingDing = (headers, params) => {
    return axios.post(`${test}/api/project/del_dingding`, params, {headers}).then(res => res.data);
};
// 修改环境
export const updateDingDing = (headers, params) => {
    return axios.post(`${test}/api/project/update_dingding`, params, {headers}).then(res => res.data);
};
export const updateEnvironment = (headers, params) => {
    return axios.post(`${test}/api/project/update_environment`, params, {headers}).then(res => res.data);
};

export const getLyzdEncryptions = (headers, params) => {
    return axios.get(`${test}/api/project/getLyzdEncryptions`, {params: params, headers: headers}).then(res => res.data);
};

//接口测试
export const runApi = (headers, params) => {
    return axios.get(`${test}/api/project/runApi`, {params: params, headers: headers}).then(res => res.data);
};
//流程测试
export const ProcesstTesting = (headers, params) => {
    return axios.get(`${test}/api/project/ProcesstTesting`, {params: params, headers: headers}).then(res => res.data);
};

export const createScript = (headers, params) => {
    return axios.get(`${test}/api/project/createScript`, {params: params, headers: headers}).then(res => res.data);
};

// 删除项目
export const delProject = (headers, params) => {
    return axios.post(`${test}/api/project/del_project`, params, {headers}).then(res => res.data);
};
// 禁用项目
export const disableProject = (headers, params) => {
    return axios.post(`${test}/api/project/disable_project`, params, {headers}).then(res => res.data);
};
// 启用项目
export const enableProject = (headers, params) => {
    return axios.post(`${test}/api/project/enable_project`, params, {headers}).then(res => res.data);
};
// 修改项目
export const updateProject = (headers, params) => {
    return axios.post(`${test}/api/project/update_project`, params, {headers}).then(res => res.data);
};
// 添加项目
export const addProject = (headers, params) => {
    return axios.post(`${test}/api/project/add_project`, params, {headers}).then(res => res.data);
};
// 获取项目详情
export const getProjectDetail = (headers, params) => {
    return axios.get(`${test}/api/title/project_info`, {params: params, headers: headers}).then(res => res.data);
};

// 获取项目详情
export const getLyHome = (headers, params) => {
    return axios.get(`${test}/api/title/lyzd_home`, {params: params, headers: headers}).then(res => res.data);
};



//***************
export const getResultDetail = (headers, params) => {
    return axios.get(`${test}/api/report/resultDetail_info`, {params: params, headers: headers}).then(res => res.data);
};

export const getRunResultByPici = (headers, params) => {
    return axios.get(`${test}/api/report/getRunResultByPici`, {params: params, headers: headers}).then(res => res.data);
};
export const getResultDetailByID = (headers, params) => {
    return axios.get(`${test}/api/report/getResultDetailByID`, {params: params, headers: headers}).then(res => res.data);
};


export const getCasebyApiID = (headers, params) => {
    return axios.get(`${test}/api/project/getCasebyApiID`, {params: params, headers: headers}).then(res => res.data);
};



// 获取测试地址列表
export const getHost = (headers, params) => {
    return axios.get(`${test}/api/global/host_total`, {params: params, headers: headers}).then(res => res.data);
};
// 删除测试地址列表
export const delHost = (headers, params) => {
    return axios.post(`${test}/api/global/del_host`, params, {headers}).then(res => res.data);
};
// 禁用测试地址列表
export const disableHost = (headers, params) => {
    return axios.post(`${test}/api/global/disable_host`, params, {headers}).then(res => res.data);
};
// 启用测试地址列表
export const enableHost = (headers, params) => {
    return axios.post(`${test}/api/global/enable_host`, params, {headers}).then(res => res.data);
};
// 修改测试地址列表
export const updateHost = (headers, params) => {
    return axios.post(`${test}/api/global/update_host`, params, {headers}).then(res => res.data);
};
// 添加测试地址列表
export const addHost = (headers, params) => {
    return axios.post(`${test}/api/global/add_host`, params, {headers}).then(res => res.data);
};
// 获取项目动态
export const getProjectDynamicList = (headers, params) => {
    return axios.get(`${test}/api/dynamic/dynamic`, {params: params, headers: headers}).then(res => res.data);
};
// 获取项目成员
export const getProjectMemberList = (headers, params) => {
    return axios.get(`${test}/api/member/project_member`, {params: params, headers: headers}).then(res => res.data);
};
// 获取发送邮件配置
export const getEmailConfigDetail = (headers, params) => {
    return axios.get(`${test}/api/member/get_email`, {params: params, headers: headers}).then(res => res.data);
};
// 删除邮件配置
export const delEmailConfig = (headers, params) => {
    return axios.post(`${test}/api/member/del_email`, params, {headers}).then(res => res.data);
};
// 添加邮件配置
export const addEmailConfig = (headers, params) => {
    return axios.post(`${test}/api/member/email_config`, params, {headers}).then(res => res.data);
};
// 获取自动化测试结果
export const getTestResultList = (headers, params) => {
    return axios.get(`${test}/api/report/auto_test_report`, {params: params, headers: headers}).then(res => res.data);
};
// 获取最近10次测试时间
export const getTestTenTime = (headers, params) => {
    return axios.get(`${test}/api/report/test_time`, {params: params, headers: headers}).then(res => res.data);
};
// 获取最近10次测试比例结果
export const getTestTenResult = (headers, params) => {
    return axios.get(`${test}/api/report/lately_ten`, {params: params, headers: headers}).then(res => res.data);
};
// 添加接口
export const addApiDetail = (headers, params) => {
    return axios.post(`${test}/api/api/add_api`, params, {headers}).then(res => res.data);
};



// 添加接口
export const addInterface = (headers, params) => {
    return axios.post(`${test}/api/api/add_interface`, params, {headers}).then(res => res.data);
};

export const editInterface = (headers, params) => {
    return axios.post(`${test}/api/api/edit_interface`, params, {headers}).then(res => res.data);
};

export const copyInterface = (headers, params) => {
    return axios.post(`${test}/api/api/copy_interface`, params, {headers}).then(res => res.data);
};
export const addCase = (headers, params) => {
    return axios.post(`${test}/api/api/addCase`, params, {headers}).then(res => res.data);
};
export const updateCase = (headers, params) => {
    return axios.post(`${test}/api/api/updateCase`, params, {headers}).then(res => res.data);
};

// 获取接口分组列表
export const getApiGroupList = (headers, params) => {
    return axios.get(`${test}/api/api/group`, {params: params, headers: headers}).then(res => res.data);
};
// add by  gaojingyu
export const getProjectList = (headers, params) => {
    return axios.get(`${test}/api/api/getProjectList`, {params: params, headers: headers}).then(res => res.data);
};




export const getEnvironmentList = (headers, params) => {
    return axios.get(`${test}/api/api/getEnvironmentList`, {params: params, headers: headers}).then(res => res.data);
};





//
export const getCheckTypeList = (headers, params) => {
    return axios.get(`${test}/api/api/getCheckTypeList`, {params: params, headers: headers}).then(res => res.data);
};

export const getCheckConditionList = (headers, params) => {
    return axios.get(`${test}/api/api/getCheckConditionList`, {params: params, headers: headers}).then(res => res.data);
};

export const getActionConditionList = (headers, params) => {
    return axios.get(`${test}/api/api/getActionConditionList`, {params: params, headers: headers}).then(res => res.data);
};

export const getCaseTypeList = (headers, params) => {
    return axios.get(`${test}/api/api/getCaseTypeList`, {params: params, headers: headers}).then(res => res.data);
};

export const getApplicationList = (headers, params) => {
    return axios.get(`${test}/api/api/getApplicationList`, {params: params, headers: headers}).then(res => res.data);
};

export const getApiListByProjectId = (headers, params) => {
    return axios.get(`${test}/api/api/getApiListByProjectId`, {params: params, headers: headers}).then(res => res.data);
};

export const getApiList = (headers, params) => {
    return axios.get(`${test}/api/api/getApiList`, {params: params, headers: headers}).then(res => res.data);
};

export const getModelList = (headers, params) => {
    return axios.get(`${test}/api/api/getModelList`, {params: params, headers: headers}).then(res => res.data);
};
//getYiLaiApiList
export const getYiLaiApiList = (headers, params) => {
    return axios.get(`${test}/api/api/getYiLaiApiList`, {params: params, headers: headers}).then(res => res.data);
};

// 添加接口分组
export const addApiGroup = (headers, params) => {
    return axios.post(`${test}/api/api/add_group`, params, {headers}).then(res => res.data);
};
// 修改接口分组
export const updateApiGroup = (headers, params) => {
    return axios.post(`${test}/api/api/update_name_group`, params, {headers}).then(res => res.data);
};
// 删除接口分组
export const delApiGroup = (headers, params) => {
    return axios.post(`${test}/api/api/del_group`, params, {headers}).then(res => res.data);
};